Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The Contents tab refreshes and shows the mod contents if you download a mod via the Download button or right click menu, but not if it is downloaded during installation.
Cause
Refreshing cache-related state (including the Contents tab) is handled (duplicatively) at the places where GUI stores or purges a mod, but when you install an uncached mod, it is downloaded and stored by
ModuleInstaller
, so GUI doesn't react.This is a brittle approach because it has a many-to-many structure, where each place that deals with the cache must also handle all of the secondary consequences itself.
Changes
NetModuleCache
hasModStored
andModPurged
events that it fires whenever mods are stored or purged, including during mod installation. If all mods are purged,ModPurged
's module parameter will be null.GUI.Main.OnModStoredOrPurged
function, which is used to handle the new events, including during installation. Places that formerly triggered the refresh now no longer do, because they don't need to anymore.UpdateCachedByDownloads
can now handle updating the full mod list'sIsCached
property when its parameter isnull
, for when the user clears the cache in the settingsManageMods.OnSelectedModuleChanged
now no longer sets ModInfo's active mod when the Manage Mods tab is not active, for whenOnModStoredOrPurged
refilters the mod list in the background during installs, because this causes ModInfo to become visible when it shouldn't. It will still be set when the Manage Mods tab becomes active again.Fixes #3998.